package com.ship.system.feign;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ship.system.api.domain.SysMessageSend;
import com.ship.system.api.domain.SysUser;
import com.ship.system.domain.SysUserDept;
import com.ship.system.service.*;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @Author zhangyh
 */
@Api(tags = "合同服务Fegin远程调用客户端")
@RestController
@RequestMapping("/systemFeign")
public class SystemFeign {

    @Autowired
    private ISysUserService iSysUserService;

    @Autowired
    private SysMessageService sysMessageService;

    @Autowired
    private ISysMenuService menuService;

    @Autowired
    private ISysUserDeptService userDeptService;

    @Autowired
    private ISysUserService userService;

    /**
     * 获取配置参数
     * @param
     * @return
     */
    @GetMapping(value = "/sys/userlist")
    public List<SysUser> getUserListInfo(){
        return iSysUserService.getUserListInfo();
    }

    /**
     * 系统消息发送
     * @param messageSend
     */
    @PostMapping(value = "/messageSend")
    public void messageSend(@RequestBody SysMessageSend messageSend){
        sysMessageService.saveMessage(messageSend);
    }

    /**
     * 系统消息发送
     * @param messageSend
     */
    @PostMapping(value = "/messageSend/batch")
    public void messageSendBatch(@RequestBody List<SysMessageSend> messageSend){
        for (SysMessageSend sysMessageSend : messageSend) {
            sysMessageService.saveMessage(sysMessageSend);
        }
    }
}
